cmake_minimum_required(VERSION 3.20)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Quick Gui Qml)
set(OpenCV_DIR "D:/OpenCvMinGW/open-cv_-ming-w/OpenCV4.11_mingw13.1.0/x64/mingw/lib")  
# Updated to point to OpenCV lib directory containing config files
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${Qt6Core_INCLUDE_DIRS})
include_directories(${Qt6Gui_INCLUDE_DIRS})

set(SOURCES
    main.cpp
    imageprocessing/ImageProcessor.cpp
)

set(QML_FILES
    main.qml
    views/demo.qml
    views/Constants.qml
)

# Register Constants.qml as singleton
set_source_files_properties(views/Constants.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)

qt_add_resources(QML_RESOURCE_FILES resource.qrc)

qt_add_executable(AppDemo
    ${SOURCES}
)

qt_add_qml_module(AppDemo
    URI AppDemo
    VERSION 1.0
    QML_FILES ${QML_FILES}
)

target_link_libraries(AppDemo
    PRIVATE
    Qt${QT_VERSION_MAJOR}::Quick
    Qt${QT_VERSION_MAJOR}::Qml
    fluentuiplugin
    ${OpenCV_LIBS}
)
